package com.jxs.android.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;

import android.annotation.SuppressLint;
import android.content.Context;

@SuppressLint("SimpleDateFormat")
public class Timer {
	public static String getTime(Context context, long all) {
		String results = "";
		long hours = all / 3600;
		all = all % 3600;
		long minuties = all / 60;
		all = all % 60;
		long seconds = all;

		if (0 != hours && minuties != 0) {
			results = hours + "时" + minuties + "分" + seconds + "秒";
		} else if (0 == hours && minuties != 0) {
			results = minuties + "分" + seconds + "秒";
		} else if (0 == hours && minuties == 0) {
			results = seconds + "秒";
		}

		return results;
	}

	public static SimpleDateFormat getSDFyyyyMMdd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyyyMM() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyMMdd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyMMdd");
		return sdf;
	}

	public static SimpleDateFormat getSDFyy__MM__dd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yy/MM/dd");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyyy_MM_dd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyyy_MM_dd_hanzi() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日");
		return sdf;
	}

	public static SimpleDateFormat getSDFyy_MM_dd() {
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyyy_MM_dd_N_HHmmss() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd\nHH:mm:ss");
		return sdf;
	}
	public static SimpleDateFormat getSDFyy_MM_dd_N_HHmmss() {
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd\nHH:mm:ss");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyMMddHHmmssS() {
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss.S");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyMMddHHmmss() {
		SimpleDateFormat sdf = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
		return sdf;
	}

	public static SimpleDateFormat getSDFyyyy_MM_dd_HHmmss() {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		return sdf;
	}

	public static String getWeekDayString(long date) {

		String weekString = "";
		final String dayNames[] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
		Calendar calendar = Calendar.getInstance();
		// calendar.setTime(date);
		calendar.setTimeInMillis(date);
		int dayOfWeek = calendar.get(Calendar.DAY_OF_WEEK);

		weekString = dayNames[dayOfWeek - 1];

		return weekString;

	}

}